package net.gz01.wallet.web.controller.org;


import java.util.ArrayList;
import java.util.List;

import com.jfinal.core.Controller;

import net.gz01.wallet.web.model.Account;
import net.gz01.wallet.web.model.Merch;
import net.gz01.wallet.web.model.OrgUser;

public class AccountController extends Controller{

	public void search(){
		OrgUser orgUser = (OrgUser) getSession().getAttribute("loginOrgUser");
		List<Merch> merchList = Merch.dao.selectByOrgCode(orgUser.getOrgCode());
		List<String> accountNoList = new ArrayList<>();
		for (Merch merch : merchList) {
			accountNoList.add(merch.getCode());
		}
		List<Account> accountList = Account.dao.selectByAccountNo(accountNoList.toArray());
		setAttr("accountList", accountList);
		render("account/accountList.html");
	}

}
